
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 1181. -- [CROATIAN2009]IZBROI选举 -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>1181: [CROATIAN2009]IZBROI选举</h2><span class=green>Time Limit: </span>10 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>162 MB<br><span class=green>Submit: </span>6&nbsp;&nbsp;<span class=green>Solved: </span>4<br>[<a href='submitpage.php?id=1181'>Submit</a>][<a href='problemstatus.php?id=1181'>Status</a>][<a href='bbs.php?id=1181'>Discuss</a>]</center><h2>Description</h2><div class=content>	在一个地区的选举中，共有V个人参加了投票，每一票只可能投给N个政党中的一个。当地的议会共有M个席位。不妨将N个政党编号为1到N，并且设编号为i的政党最终的得票为Vi，则议会中的席位按如下规则分配：
	1、将得票数小于总选票的5%的政党剔除。
2、初始时议会为空，每个政党都只有0个席位。
	3、对于每个政党P，计算一个参数Qp = Vp / (Sp + 1)，Vp为政党P的最终得票，Sp为政党P当前已经在议会拥有的席位。
	4、给Qp最大的政党分配一个席位，如果有多个政党的Qp相同，则将席位分给其中编号最小的政党。
	5、重复3和4，直到议会已满。
	由于计票还没有结束，现在我们只知道一部分选票的投票结果。给出V、N、M以及每个政党当前的得票，请你计算每个政党最多以及最少能赢得多少个席位。
</div><h2>Input</h2><div class=content></div><h2>Output</h2><div class=content></div><h2>Sample Input</h2>
			<div class=content><span class=sampledata>20 4 5<br />
4 3 6 1</span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata>3 3 3 2<br />
1 0 1 0</span></div><h2>HINT</h2>
			<div class=content><p>14 votes have been tallied and 6 are yet to be counted. To illustrate one possible<br />
outcome, suppose that the first party receives 2 of those 6 votes, the second none, the third 1 vote and<br />
the fourth 3 votes. The parties' totals are 6, 3, 7 and 4 votes. All parties exceeded the 5% threshold.<br />
Seats are allocated as follows:<br />
1. The quotients are initially 6/1, 3/1, 7/1 and 4/1; the largest is 7/1 so party 3 wins a seat.<br />
2. The quotients are 6/1, 3/1, 7/2 and 4/1; the largest is 6/1 so party 1 wins a seat.<br />
3. The quotients are 6/2, 3/1, 7/2 and 4/1; the largest is 4/1 so party 4 wins a seat.<br />
4. The quotients are 6/2, 3/1, 7/2 and 4/2; the largest is 7/2 so party 3 wins a seat.<br />
5. The quotients are 6/2, 3/1, 7/3 and 4/2; parties 1 and 2 are tied with quotients 6/2 and 3/1,<br />
but party 1 is lower numbered so it wins the last seat.<br />
In this outcome, the numbers of seats won by the parties are 2, 0, 2 and 1. Since it is possible for the<br />
second party not to win any seats, the second number on the second line of output is zero.</p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search='></a></p></div><center>[<a href='submitpage.php?id=1181'>Submit</a>][<a href='problemstatus.php?id=1181'>Status</a>][<a href='bbs.php?id=1181'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
